<!--# layout("/common/layout.html",{"jsBase":"/js/saas/saasTenant/"}){ -->

<form class="layui-form layui-form-pane" id="addForm"  lay-filter="editform">
    <input type="hidden" name="tenantId" id="tenantId">

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
            <label class="layui-form-label">承租人名称</label>
				<div class="layui-input-inline" style="width:512px">
                                <input type="text" name="tenantName" id="tenantName" autocomplete="off" maxlength="50" class="layui-input" lay-verify="required">
				</div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">区域限制</label>
                <div class="layui-input-inline">
                    <input type="radio" name="provinceLimits" value="1" title="有">
                    <input type="radio" name="provinceLimits" value="0" title="无">
                </div>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">绑定地址</label>
                <div class="layui-input-inline" style="width:838px">
                    <input type="text" name="tenantUrl" id="tenantUrl" autocomplete="off" maxlength="100" class="layui-input" lay-verify="required">
                </div>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
            <label class="layui-form-label">承租人类型</label>
				<div class="layui-input-inline">
                                <layui:simpleDataSelect name="tenantType" value="${has(saasTenant)?saasTenant.tenantType:''}" data="${tenantTypeList}"
                                            attrId="id" attrName="name" laySearch="true" />
				</div>
            </div>
            <div class="layui-inline">
            <label class="layui-form-label">承租人电话</label>
				<div class="layui-input-inline">
                                <input type="text" name="tenantPhone" id="tenantPhone" autocomplete="off" maxlength="50" class="layui-input" >
				</div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">承租人邮箱</label>
                <div class="layui-input-inline">
                    <input type="text" name="tenantMail" id="tenantMail" autocomplete="off" maxlength="50" class="layui-input" >
                </div>
            </div>
        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">承租人地址</label>
                <div class="layui-input-inline"  style="width:512px">
                    <input type="text" name="tenantAddr" id="tenantAddr" autocomplete="off" maxlength="50" class="layui-input" >
                </div>
            </div>
            <div class="layui-inline">
            <label class="layui-form-label">可用标记</label>
				<div class="layui-input-inline">
                                <input type="radio" name="tenantStatus" value="1" title="是">
                                <input type="radio" name="tenantStatus" value="0" title="否">
				</div>
            </div>
        </div>
    </div>

    <layui:submitButtons id="addButton" />
</form>
<!--#} -->
<script>
layui.extend({
    loading: '../../../plugins/layui_extends/loading/loading',
}).define([ 'form', 'laydate', 'table','loading','saasTenantApi'], function(exports) {
    var form = layui.form;
    var saasTenantApi = layui.saasTenantApi;
    var index = layui.index;
    var isNew = true;
    <!--# if(!(isEmpty(saasTenantJson))){  -->
    isNew = false;
    <!--# } -->
    var view = {
        init:function(){
            Lib.initGenrealForm($("#addForm"),form);
            this.initSubmit();
        },
        initSubmit:function(){
            $("#addButton").click(function(){
                // $("#addButton").hide();
                // $("#addButton-loading").show();
                // $("#addButton-loading").loading();
                form.on('submit(form)', function(){
                    saasTenantApi.saveForm(isNew,$('#addForm'),function(){
                        parent.window.dataReload();
                        Common.info("保存成功");
                        Lib.closeFrame();
                    });
                });
            });

            $("#addButton-cancel").click(function(){
                Lib.closeFrame();
            });
        }

    }
    view.init();
    <!--# if(!(isEmpty(saasTenantJson))){  -->
    var formJson = ${saasTenantJson};
    form.val("editform",formJson);
    <!--# } -->
});
</script>
